package com.ddyx.common.utils.encrypt;

import java.util.UUID;

public class MemberCardUtil {
	
	/**
	 * @desc 会员卡生成密钥
	 * @param key
	 * @return
	 */
	public static String encryptSecretKey(String key) {
		String nonceStr = UUID.randomUUID().toString().replace("-", "");
		String encryptStr = AESUtil.encrypt(key+"&"+nonceStr, "");
		return encryptStr;
	}
	
	/**
	 * @desc 会员卡解密密钥
	 * @param key
	 * @return
	 */
	public static String decryptSecretKey(String key) {
		String nonceStr = UUID.randomUUID().toString().replace("-", "");
		String encryptStr = AESUtil.decrypt(key, "");
		return encryptStr;
	}
	
	public static void main(String[] args) {
//		String wxUid = "cf2687ee-bcdc-4dd1-9ea3-e10aec5c96a0";
//		String s1 = MemberCardUtil.encryptSecretKey(wxUid+"&"+1);
//		System.out.println(s1);
//		String decrypt = MemberCardUtil.decryptSecretKey(s1);
//		System.out.println(decrypt);
//		String[] split = decrypt.split("&");
//		for (String str : split) {
//			System.out.println(str);
//		}
		System.out.println(MemberCardUtil.decryptSecretKey("Nt/nQV3ewMnFmJkV/JM5EyHZ6jTWeX8EDMR+9yVGvWpAmcEMZmZArBb4oLxp8hyL5GDfrYr22sxPXm3jYfJs6oiMnqyhOYEDHev6URZbwkg="));
	}
	
}
